The manifestation of multi-threading in processors may occur at different levels or at differing degrees of process granularity. The various threads of a multi-threaded processor may share one or more levels of caches and memory. The threads may have different data attributes like “streaming data,” “localized data,” “multiple-use data,” “shared,” “non-shared,” etc. Simple allocation and replacement schemes like least recently used (LRU) are unsuitable because the different contexts created by the threads and data attributes specific to threads must be accounted for.
For example, in the absence of specialized allocation/replacement mechanisms, cache lines of a shared cache that have been populated by streaming data may be replaced by localized data or multiple-use data of another thread. Such scenarios are unacceptable and may lead to severe degradation of processing speed and efficiency.
Some shared caches may include a static partitioning to keep data from different threads separate. However, with static partitioning, the threads get statically locked to a particular cache partition, which leads to additional drawbacks. For example, a data attribute of a thread may dynamically transition from streaming data to localized data or vice-versa. As can be seen, static partitioning that locks threads too allocate in predefined portions of a cache, cannot account for such dynamic transitions of data attributes in threads.
Accordingly, there is a need in the art for flexible cache allocation in shared caches which avoid the aforementioned drawbacks.